﻿<UserControl
    x:Class="ApplicationSettings.Settings.ContextSpecificSettings"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ApplicationSettings"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Common="using:WinRTFramework.Common"
    mc:Ignorable="d"
    d:DesignHeight="768"
    d:DesignWidth="346">

    <UserControl.Resources>
        <Style x:Key="TitleTextStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI Light" />
            <Setter Property="FontSize" Value="16" />
        </Style>
        <Style x:Key="HeaderTextStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI Semilight" />
            <Setter Property="FontSize" Value="26.667" />
            <Setter Property="Margin" Value="0,0,0,25" />
        </Style>
        <Style x:Key="H2Style" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI" />
            <Setter Property="FontSize" Value="14.667" />
            <Setter Property="Margin" Value="0,0,0,0" />
        </Style>
        <Style x:Key="SubheaderTextStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI Semilight" />
            <Setter Property="FontSize" Value="14.667" />
            <Setter Property="Margin" Value="0,0,0,5" />
        </Style>
        <Style x:Key="BasicTextStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI Light" />
            <Setter Property="FontSize" Value="16" />
        </Style>
        <Style x:Key="SeparatorStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI" />
            <Setter Property="FontSize" Value="9" />
        </Style>
        <Style x:Key="FooterStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Segoe UI" />
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Margin" Value="0,8,0,0" />
        </Style>
        <Style x:Key="HyperlinkStyle" TargetType="HyperlinkButton">
            <Setter Property="Padding" Value="5"/>
        </Style>

        <Style x:Key="SettingsBackButtonStyle" TargetType="Button">
            <Setter Property="MinWidth" Value="0"/>
            <Setter Property="FontFamily" Value="Segoe UI Symbol"/>
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="FontSize" Value="26.66667"/>
            <Setter Property="AutomationProperties.AutomationId" Value="BackButton"/>
            <Setter Property="AutomationProperties.Name" Value="Back"/>
            <Setter Property="AutomationProperties.ItemType" Value="Navigation Button"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid x:Name="RootGrid" Width="30" Height="30">
                            <Grid Margin="-6,-6,0,0">
                                <TextBlock x:Name="BackgroundGlyph" Text="&#xE0D4;" Foreground="Transparent"/>
                                <TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonSnappedGlyph}" Foreground="White"/>
                                <TextBlock x:Name="ArrowGlyph" Text="&#xE0C4;" Foreground="#00b2f0" Opacity="0"/>
                            </Grid>
                            <Rectangle
                                x:Name="FocusVisualWhite"
                                IsHitTestVisible="False"
                                Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}" 
                                StrokeEndLineCap="Square"
                                StrokeDashArray="1,1"
                                Opacity="0"
                                StrokeDashOffset="1.5"
                                />

                            <Rectangle
                                x:Name="FocusVisualBlack"
                                IsHitTestVisible="False"
                                Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}" 
                                StrokeEndLineCap="Square"
                                StrokeDashArray="1,1"
                                Opacity="0"
                                StrokeDashOffset="0.5"
                                />

                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="PointerOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="White"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimation
                                            Storyboard.TargetName="ArrowGlyph"
                                            Storyboard.TargetProperty="Opacity"
                                            To="1"
                                            Duration="0"/>
                                            <DoubleAnimation
                                            Storyboard.TargetName="NormalGlyph"
                                            Storyboard.TargetProperty="Opacity"
                                            To="0"
                                            Duration="0"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimation
                                            Storyboard.TargetName="FocusVisualWhite"
                                            Storyboard.TargetProperty="Opacity"
                                            To="1"
                                            Duration="0"/>
                                            <DoubleAnimation
                                            Storyboard.TargetName="FocusVisualBlack"
                                            Storyboard.TargetProperty="Opacity"
                                            To="1"
                                            Duration="0"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unfocused" />
                                    <VisualState x:Name="PointerFocused" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <Border BorderBrush="#00b2f0" BorderThickness="1,0,0,0">
        <Grid Background="White" VerticalAlignment="Stretch">

            <!-- Root grid definition -->
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <!-- Header area for panel -->
            <Grid Background="#00b2f0" Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <StackPanel Orientation="Horizontal" Grid.Column="0" Margin="40, 32, 17, 13">
                    <Button Command="{Binding ReturnToSettingsCommand}" Margin="0,3,0,0"  Style="{StaticResource SettingsBackButtonStyle}"/>
                    <TextBlock Margin="10,0,0,0" FontFamily="Segoe UI" FontWeight="SemiLight" FontSize="24.6667" Text="Context Specific" Foreground="White"/>
                </StackPanel>
            </Grid>

            <!-- Settings Panel Content -->
            <ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="1">
                <Grid Margin="40,33,40,39" VerticalAlignment="Top" Grid.RowSpan="3">
                    <Grid.Resources>
                        <SolidColorBrush Color="Red" x:Key="BrushRed"/>
                        <SolidColorBrush Color="Green" x:Key="BrushGreen"/>
                        <SolidColorBrush Color="Blue" x:Key="BrushBlue"/>
                    </Grid.Resources>

                    <StackPanel x:Name="FlyoutContent">
                        <TextBlock FontWeight="Bold" Text="Background Color" TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left"/>
                        
                        <StackPanel Orientation="Horizontal">
                            <RadioButton GroupName="ColorGroup"  Command="{Binding ChangeColorCommand}" CommandParameter="{StaticResource BrushRed}">
                                <Rectangle Fill="Red" Width="16" Height="16" VerticalAlignment="Center" />
                            </RadioButton>

                            <RadioButton GroupName="ColorGroup" Command="{Binding ChangeColorCommand}" CommandParameter="{StaticResource BrushGreen}">
                                <Rectangle Fill="Green" Width="16" Height="16" VerticalAlignment="Center" />
                            </RadioButton>

                            <RadioButton GroupName="ColorGroup"  Command="{Binding ChangeColorCommand}" CommandParameter="{StaticResource BrushBlue}">
                                <Rectangle Fill="Blue" Width="16" Height="16" VerticalAlignment="Center"/>
                            </RadioButton>
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </ScrollViewer>
        </Grid>

    </Border>
</UserControl>
